package com.edu.controller;

import com.edu.dao.impl.MyBatisProductDaoImpl;
import com.edu.data.News;
import com.edu.data.Product;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("/product")
public class EasyBuyProductController {
    MyBatisProductDaoImpl dao = new MyBatisProductDaoImpl();

    @RequestMapping("allproduct")
    public String allProduct(Model model){
        List<Product> productList = dao.getAllProduct();
        model.addAttribute("products",productList);
        return "index";
    }
}
